home *** CD-ROM | disk | FTP | other *** search
/ 8bitfiles.net/archives / archives.tar / archives / compuserve-file-archive / 12 C64 Telecom / TERM80.TXT < prev    next >
Encoding:
Text File  |  2019-04-13  |  9.7 KB  |  222 lines

  1. ; This program makes the Commodore 64 operate like a semi-
  2. ; intelligent 40 or 80 column ASCII terminal.  It supports input
  3. ; and display of all the ASCII characters, and beeps when the BEL
  4. ; character is received.  Beware that the 80 column display mode
  5. ; will probably require a monitor unless you are using a B/W
  6. ; TV set with outstanding sharpness and video bandwidth.
  7. ;
  8. ; The communication protocol is full duplex, 8 bits, no
  9. ; parity, 1 stop bit, 300 or 1200 baud, with XON/XOFF (DC1/
  10. ; DC3) host flow control protocol -- this should satisfy most
  11. ; host computers.  The display screen is 40 columns X 25 lines
  12. ; or 80 columns X 25 lines.
  13. ;
  14. ; Because of the unusual layout of the C64 keyboard, the
  15. ; desire to support all ASCII characters, and a personal
  16. ; need to find the ESC and BS keys in their usual positions,
  17. ; the following key substitutions apply (note- ^x is short-
  18. ; hand for CONTROL-x):
  19. ;
  20. ;       TO SEND         TYPE
  21. ;       -------         ----
  22. ;       BACKSLASH       BRITISH-POUND
  23. ;       ^BACKSLASH      ^BRITISH-POUND
  24. ;       ^UNDERLINE      ^=
  25. ;       CARET           UP-ARROW
  26. ;       ^CARET          ^UP-ARROW
  27. ;       ^[ (ESC)        ^[ or BACK-ARROW
  28. ;       UNDERLINE       F1
  29. ;       VERTICAL-BAR    F2
  30. ;       GRAVE-ACCENT    F3
  31. ;       TILDE           F4
  32. ;       LEFT-BRACE      F5
  33. ;       RIGHT-BRACE     F6
  34. ;       DEL (RUB)       F7
  35. ;       ^T              F8
  36. ;       ^H (BS)         DEL, ^H, or ^T
  37. ;       ^J (NL)         SHIFT/RETURN or ^J
  38. ;       ^S (DC3)        ^S or HOME
  39. ;       ^Q (DC1)        ^Q or CURSOR DOWN
  40. ;       ^I (TAB)        ^I (ie. No separate TAB key)
  41. ;
  42. ; The CONTROL-8 key is used to switch the program from 40 column
  43. ; to 80 column mode.  The CONTROL-4 key is used to switch the
  44. ; program back from 80 column to 40 column mode.  Depressing one
  45. ; of these keys when already in the corresponding mode will simply
  46. ; clear the screen (as it does when switching modes).
  47. ;
  48. ; Note that pressing the COMMODORE key will place the terminal
  49. ; program in a suspended display mode (ie. the cursor will freeze
  50. ; at its current position), and ^S will be sent to the host
  51. ; computer when the RS-232 input buffer fills up.  Similarly,
  52. ; pressing the COMMODORE key will remove the terminal from the
  53. ; suspended display mode and send a ^Q to the host computer only
  54. ; if a ^S had previously been sent and the buffer has become nearly
  55. ; empty.  This enables the COMMODORE key to be used like the SCROLL/
  56. ; NO-SCROLL key on DEC terminals.  Suspended display mode is
  57. ; indicated to the user by the cursor blinking much faster than
  58. ; normal, an indication that the COMMODORE key must be pressed to
  59. ; resume displaying the received text.  The program may also send
  60. ; ^S and ^Q to the host computer on it's own from time to time if
  61. ; it detects an impending RS-232 buffer overflow condition - this
  62. ; normally will only occur while printing a number of short or blank
  63. ; lines while scrolling the screen up (or down), since 4 to 15 char-
  64. ; acters are received into the RS-232 buffer during the time it
  65. ; takes to scroll the whole screen.  In any case, this automatic
  66. ; flow control is fully synchronized with the flow control
  67. ; necessitated by the use of the COMMODORE key to suspend and resume
  68. ; the display of received text.  Depressing the ^S and ^Q keys (or
  69. ; their substitutes indicated above) unconditionally sends those
  70. ; ASCII characters to the remote host computer without any local
  71. ; effect.
  72. ;
  73. ; This terminal program does *not* support flow control in the
  74. ; opposite direction - receiving ^S from the host computer will not
  75. ; lock the keyboard or have any other effect, nor will ^Q.
  76. ;
  77. ; Also note that pressing the RUN/STOP key with SHIFT depres-
  78. ; sed will cleanly terminate the terminal emulator program,
  79. ; and generate the BRK interrupt to send the C64 back
  80. ; to whoever is servicing those interrupts (BASIC,
  81. ; SUPERMON64,etc).
  82. ;
  83. ; All 94 printable ASCII characters and the space will
  84. ; be displayed on the screen as received over the RS-232
  85. ; channel.  Most of the remaining (control) characters are
  86. ; not displayed- however the following control characters
  87. ; and escape sequences have special effects:
  88. ;
  89. ;       CHARACTER       EFFECT
  90. ;       ---------       ------
  91. ;       ^G (BEL)        beeps the TV
  92. ;       ^H (BS)         cursor backspaces
  93. ;       ^I (TAB)        cursor moves right to next tab stop
  94. ;       ^J (NL)         cursor moves down one line with scrolling
  95. ;       ^M (CR)         cursor moves to start of line
  96. ;       ^[A             cursor moves up one line
  97. ;       ^[B             cursor moves down
  98. ;       ^[C             cursor moves right one char.
  99. ;       ^[D             cursor moves left one char.
  100. ;       ^[H             cursor homes
  101. ;       ^[I             cursor moves up one line with scrolling
  102. ;       ^[J             clears from cursor to end of screen
  103. ;       ^[K             clears from cursor to end of line
  104. ;       ^[Ylc           cursor moves to line l-$20, col c-$20
  105. ;       ^[Z             sends DEC VT-52 terminal id string
  106. ;       ^[n             turns off reverse video
  107. ;       ^[o             turns on reverse video
  108. ;       ^[^BACKSLASH    initiates downline load
  109. ;
  110. ; Tab stops are pre-defined and fixed at every 8 columns
  111. ; beginning with column 0 (ie. 0, 8, 16, 24, ...).
  112. ;
  113. ; The rest should all be pretty much self explanatory except
  114. ; for "downline load".  Once the ^[^BACKSLASH sequence has been re-
  115. ; ceived, the program expects lines to come in over the RS-
  116. ; 232 channel of the form:
  117. ;
  118. ;       ;llhhdddddddddd...
  119. ;
  120. ; where "llhh" is the address for the first byte of data
  121. ; on the line (in 6502 low/high format), and "dddddd.."
  122. ; are the data bytes themselves - note that the address
  123. ; must be 4 hexadecimal digits and each data byte must
  124. ; be 2 hexadecimal digits.  The load is terminated normally
  125. ; by reception of the control character ^CARET, or abnormally
  126. ; if the user hits a key on the C64 keyboard during the
  127. ; load.  In the 40 column mode, It is possible to load anywhere
  128. ; in the address ranges $0800 through $9FFF and $C000 through
  129. ; $CFFF since the terminal program itself hides under the BASIC
  130. ; ROM (from $A000 through $BFFF).  80 column mode should not
  131. ; be used to download into the address range $5C00 through
  132. ; $7FFF because that is where the high resolution video matrix
  133. ; and screen image reside in that mode.
  134. ;
  135. ; VAX UNIX users (Berkeley 4.1bsd) will find that the following
  136. ; "termcap" entries effectively describe this terminal program
  137. ; for use with the terminal dependent UNIX programs (eg. vi,
  138. ; emacs, more, rogue, etc.):
  139. ;
  140. ;  qcc64C64Commodore 64:co#40:li#25:\
  141. ;          :up=\EA:do=\EB:cl=\EH\EJ:am:bs:\
  142. ;          :bw:ho=\EH:nd=\EC:so=\Eo:\
  143. ;          :se=\En:cm=\EY%+ %+ :\
  144. ;          :ce=\EK:sr=\EI:pt:
  145. ;
  146. ;  qdc64wC64WCommodore 64 80 Col X 25 Lin:co#80:li#25:\
  147. ;          :up=\EA:do=\EB:cl=\EH\EJ:bs:\
  148. ;          :bw:ho=\EH:nd=\EC:so=\Eo:\
  149. ;          :se=\En:cm=\EY%+ %+ :\
  150. ;          :ce=\EK:sr=\EI:pt:
  151. ;                                      (note: \ is BACKSLASH)
  152. ;
  153. ; VAX VMS users can probably get away with the following (although
  154. ; some VMS programs [e.g. EDT] require an auxilliary keypad, and do
  155. ; not work especially well in 40 column mode):
  156. ;
  157. ;          set term /dev=vt52
  158. ;          set term /pag=25
  159. ;          set term /wid=80  [or 40, as the case may be]
  160. ;
  161. ; TOPS-20 users can run "emacs" and the like after the following:
  162. ;
  163. ;          term vt52
  164. ;          term length 25
  165. ;          term width 80  [or 40, as the case may be]
  166. ;          term pause com
  167. ;
  168. ; A low pitched beep (much lower than that generated by
  169. ; receipt of the BEL character) indicates an error on the
  170. ; RS-232 channel (a hit, lost data, etc).
  171. ;
  172. ; Of course, this program assumes you have been able
  173. ; to connect a modem (or null modem) to the C64 user
  174. ; port, which may or may not be trivial!
  175. ;
  176. ; To run the terminal program, just load it like any BASIC
  177. ; program and RUN it.  You will be prompted for the baud
  178. ; rate.  Enter either 3 or 300 for 300 baud, 12 or 1200
  179. ; for 1200 baud, or just a carriage return for the default
  180. ; (300 baud).  If you find communications shaky or impos-
  181. ; sible at 1200 baud, you may have to change the POKE in
  182. ; basic which POKEs 0 to poke 8 instead.  If this fails to
  183. ; help, try tuning the optional baud rate constants in 0A4F
  184. ; and 0A50 for your system clock as described in ref. guide
  185. ; page 350 (use POKE of 0 into 0A4D in this case).
  186. ;
  187. ; Once it has been run, the terminal program moves itself
  188. ; under the BASIC ROM and runs there (although the original
  189. ; copy remains where it was loaded and can be re-run as long
  190. ; as it remains intact).  The memory map at run time is:
  191. ;
  192. ;       $A080-$AFFF     The program area
  193. ;       $B000-$B1FF     Unused
  194. ;       $B200-$B2FF     RS-232 output buffer
  195. ;       $B300-$B3FF     RS-232 input buffer
  196. ;       $B400-$B7FF     Video matrix (the 40 column screen)
  197. ;       $B800-$BFFF     Character set for 40 column mode
  198. ;       $02A7-$02B6     Termination/Restart code
  199. ;
  200. ; In addition, the following memory areas are used only while the
  201. ; program is in the 80 column mode:
  202. ;
  203. ;       $5C00-$5FFF     Video matrix (the 80 column color memory)
  204. ;       $6000-$7FFF     Hires screen (the 80 column screen)
  205. ;
  206. ; Once the terminal program has been terminated (with SHIFT/
  207. ; RUN/STOP), it may be re-started by re-running the original
  208. ; BASIC program.  However, if the BASIC program area has been
  209. ; over-written during downloading, the terminal program can
  210. ; still be restarted (at the same baud rate as before) with
  211. ; the BASIC direct command "SYS(686)"; this command will
  212. ; restart the terminal program at any time, even after running
  213. ; other programs, unless some program is run which pokes
  214. ; into the areas shown in the first map above.
  215. ;
  216. ; One last warning: this program is not relocatable - do
  217. ; not change the *length* of the BASIC program or nothing
  218. ; will work!
  219. ;
  220. ; Good Luck and Enjoy....
  221. ;               Frank Prindle
  222.